Column

Distribution of order time for each department

data(instacart)
x <- list(
  title = "Department"
)
y <- list(
  title = "Order Hour of Day"
)

instacart %>% 
  group_by(department) %>%
  plot_ly(x = ~department, y = ~order_hour_of_day, color = ~department, type = "box") %>%
  layout(xaxis = x, yaxis = y)
## Warning in RColorBrewer::brewer.pal(N, "Set2"): n too large, allowed maximum for palette Set2 is 8
## Returning the palette you asked for with that many colors

## Warning in RColorBrewer::brewer.pal(N, "Set2"): n too large, allowed maximum for palette Set2 is 8
## Returning the palette you asked for with that many colors

Column

Number of items ordered in each department

x <- list(
  title = "Department"
)
y <- list(
  title = "Count"
)

instacart %>% 
  count(department) %>%
  mutate(department = fct_reorder(department, -n)) %>%
  plot_ly(x = ~department, y = ~n, color = ~department) %>%
  layout(xaxis = x, yaxis = y)
## No trace type specified:
##   Based on info supplied, a 'bar' trace seems appropriate.
##   Read more about this trace type -> https://plot.ly/r/reference/#bar
## Warning in RColorBrewer::brewer.pal(N, "Set2"): n too large, allowed maximum for palette Set2 is 8
## Returning the palette you asked for with that many colors

## Warning in RColorBrewer::brewer.pal(N, "Set2"): n too large, allowed maximum for palette Set2 is 8
## Returning the palette you asked for with that many colors

Number of items ordered during each day of the week

x <- list(
  title = "Order Hour of Day"
)
y <- list(
  title = "Count"
)

instacart %>% 
  mutate(order_dow = factor(order_dow, c(0, 1, 2, 3, 4, 5, 6), c("Day 0", "Day 1", "Day 2", "Day 3", "Day 4", "Day 5", "Day 6"))) %>%
  group_by(order_dow) %>%
  count(order_hour_of_day) %>% 
  plot_ly(x = ~order_hour_of_day, y = ~n, color = ~order_dow, type = "scatter", mode = "lines") %>%
  layout(xaxis = x, yaxis = y)